Skip to content

Update docs and add doctests #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Aug 16, 2025
Merged

Conversation

abhro
Copy link
Contributor

@abhro abhro commented Apr 21, 2025

Please see the commmit messages for relevant changes

This comment was marked as outdated.

@icweaver icweaver mentioned this pull request May 13, 2025
2 tasks
Copy link
Contributor

github-actions bot commented Jun 6, 2025

Benchmark Results (Julia v1.10)

Time benchmarks
main 8023fe2... main / 8023fe2...
Quantity/creation/Quantity(x) 2.79 ± 0.001 ns 3.11 ± 0.01 ns 0.9 ± 0.0029
Quantity/creation/Quantity(x, length=y) 3.41 ± 0.01 ns 3.11 ± 0.01 ns 1.1 ± 0.0048
Quantity/with_numbers/*real 3.1 ± 0.01 ns 3.11 ± 0.001 ns 1 ± 0.0032
Quantity/with_numbers/^int 8.05 ± 2.2 ns 8.67 ± 2.5 ns 0.929 ± 0.37
Quantity/with_numbers/^int * real 8.37 ± 1.9 ns 8.37 ± 2.2 ns 1 ± 0.34
Quantity/with_quantity/+y 4.04 ± 0.001 ns 4.04 ± 0.01 ns 1 ± 0.0025
Quantity/with_quantity//y 3.11 ± 0.01 ns 3.42 ± 0.01 ns 0.909 ± 0.004
Quantity/with_self/dimension 4.02 ± 0.011 ns 4.03 ± 0.011 ns 0.998 ± 0.0039
Quantity/with_self/inv 3.11 ± 0.01 ns 3.41 ± 0.01 ns 0.912 ± 0.004
Quantity/with_self/ustrip 3.71 ± 0.01 ns 3.1 ± 0.01 ns 1.2 ± 0.005
QuantityArray/broadcasting/multi_array_of_quantities 0.14 ± 0.0035 ms 0.147 ± 0.0027 ms 0.956 ± 0.03
QuantityArray/broadcasting/multi_normal_array 0.0528 ± 0.0029 ms 0.0558 ± 0.0031 ms 0.947 ± 0.074
QuantityArray/broadcasting/multi_quantity_array 0.157 ± 0.00082 ms 0.157 ± 0.00089 ms 1 ± 0.0077
QuantityArray/broadcasting/x^2_array_of_quantities 23.2 ± 1.5 μs 23 ± 1.4 μs 1.01 ± 0.09
QuantityArray/broadcasting/x^2_normal_array 4.45 ± 0.91 μs 4.37 ± 0.99 μs 1.02 ± 0.31
QuantityArray/broadcasting/x^2_quantity_array 6.93 ± 0.23 μs 6.9 ± 0.27 μs 1 ± 0.052
QuantityArray/broadcasting/x^4_array_of_quantities 0.0813 ± 0.00054 ms 0.0814 ± 0.0015 ms 0.999 ± 0.02
QuantityArray/broadcasting/x^4_normal_array 0.0498 ± 0.00016 ms 0.0498 ± 0.00016 ms 1 ± 0.0046
QuantityArray/broadcasting/x^4_quantity_array 0.053 ± 0.00021 ms 0.0499 ± 0.00018 ms 1.06 ± 0.0057
time_to_load 0.185 ± 0.002 s 0.185 ± 0.001 s 1 ± 0.012
Memory benchmarks
main 8023fe2... main / 8023fe2...
Quantity/creation/Quantity(x) 0 allocs: 0 B 0 allocs: 0 B
Quantity/creation/Quantity(x, length=y) 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/*real 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/^int 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/^int * real 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_quantity/+y 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_quantity//y 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/dimension 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/inv 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/ustrip 0 allocs: 0 B 0 allocs: 0 B
QuantityArray/broadcasting/multi_array_of_quantities 2 allocs: 0.382 MB 2 allocs: 0.382 MB 1
QuantityArray/broadcasting/multi_normal_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
QuantityArray/broadcasting/multi_quantity_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
QuantityArray/broadcasting/x^2_array_of_quantities 2 allocs: 0.382 MB 2 allocs: 0.382 MB 1
QuantityArray/broadcasting/x^2_normal_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
QuantityArray/broadcasting/x^2_quantity_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
QuantityArray/broadcasting/x^4_array_of_quantities 2 allocs: 0.382 MB 2 allocs: 0.382 MB 1
QuantityArray/broadcasting/x^4_normal_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
QuantityArray/broadcasting/x^4_quantity_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
time_to_load 0.153 k allocs: 14.5 kB 0.153 k allocs: 14.5 kB 1

Copy link
Contributor

github-actions bot commented Jun 6, 2025

Benchmark Results (Julia v1)

Time benchmarks
main 8023fe2... main / 8023fe2...
Quantity/creation/Quantity(x) 4.02 ± 0.01 ns 3.1 ± 0.01 ns 1.29 ± 0.0053
Quantity/creation/Quantity(x, length=y) 3.42 ± 0.01 ns 3.43 ± 0.011 ns 0.997 ± 0.0043
Quantity/with_numbers/*real 3.1 ± 0.01 ns 3.1 ± 0.01 ns 1 ± 0.0046
Quantity/with_numbers/^int 8.68 ± 1.9 ns 8.67 ± 1.9 ns 1 ± 0.3
Quantity/with_numbers/^int * real 9.29 ± 2.2 ns 9.29 ± 2.2 ns 1 ± 0.33
Quantity/with_quantity/+y 4.35 ± 0.01 ns 4.35 ± 0.01 ns 1 ± 0.0033
Quantity/with_quantity//y 3.11 ± 0.001 ns 3.11 ± 0.01 ns 1 ± 0.0032
Quantity/with_self/dimension 3.11 ± 0.01 ns 3.1 ± 0.01 ns 1 ± 0.0046
Quantity/with_self/inv 3.11 ± 0.01 ns 3.11 ± 0.01 ns 1 ± 0.0046
Quantity/with_self/ustrip 2.79 ± 0.01 ns 2.79 ± 0.01 ns 0.997 ± 0.0051
QuantityArray/broadcasting/multi_array_of_quantities 0.0904 ± 0.0059 ms 0.0905 ± 0.00081 ms 0.998 ± 0.066
QuantityArray/broadcasting/multi_normal_array 0.0528 ± 0.00019 ms 0.0528 ± 0.00027 ms 1 ± 0.0063
QuantityArray/broadcasting/multi_quantity_array 0.0622 ± 0.0002 ms 0.0546 ± 0.0093 ms 1.14 ± 0.19
QuantityArray/broadcasting/x^2_array_of_quantities 13.4 ± 2.9 μs 13 ± 1.9 μs 1.04 ± 0.27
QuantityArray/broadcasting/x^2_normal_array 2.29 ± 1.2 μs 2.19 ± 1.2 μs 1.04 ± 0.79
QuantityArray/broadcasting/x^2_quantity_array 3.48 ± 0.15 μs 3.47 ± 0.13 μs 1 ± 0.057
QuantityArray/broadcasting/x^4_array_of_quantities 0.0843 ± 0.0012 ms 0.0842 ± 0.00096 ms 1 ± 0.018
QuantityArray/broadcasting/x^4_normal_array 0.0497 ± 0.00015 ms 0.0497 ± 0.00018 ms 1 ± 0.0047
QuantityArray/broadcasting/x^4_quantity_array 0.0529 ± 0.00014 ms 0.0529 ± 0.003 ms 1 ± 0.057
time_to_load 0.201 ± 0.0011 s 0.202 ± 0.002 s 0.999 ± 0.011
Memory benchmarks
main 8023fe2... main / 8023fe2...
Quantity/creation/Quantity(x) 0 allocs: 0 B 0 allocs: 0 B
Quantity/creation/Quantity(x, length=y) 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/*real 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/^int 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/^int * real 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_quantity/+y 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_quantity//y 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/dimension 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/inv 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/ustrip 0 allocs: 0 B 0 allocs: 0 B
QuantityArray/broadcasting/multi_array_of_quantities 3 allocs: 0.382 MB 3 allocs: 0.382 MB 1
QuantityArray/broadcasting/multi_normal_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
QuantityArray/broadcasting/multi_quantity_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
QuantityArray/broadcasting/x^2_array_of_quantities 3 allocs: 0.382 MB 3 allocs: 0.382 MB 1
QuantityArray/broadcasting/x^2_normal_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
QuantityArray/broadcasting/x^2_quantity_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
QuantityArray/broadcasting/x^4_array_of_quantities 3 allocs: 0.382 MB 3 allocs: 0.382 MB 1
QuantityArray/broadcasting/x^4_normal_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
QuantityArray/broadcasting/x^4_quantity_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
time_to_load 0.159 k allocs: 11.2 kB 0.159 k allocs: 11.2 kB 1

@icweaver
Copy link
Contributor

Hi @abhro, hope you've been well! I love this PR and just wanted to check back in about its current status. I think getting it in would be really helpful for keeping the docs in sync with the QuantityArray PR (#178) I'm working on, especially if we could make the use of @example blocks a bit more ubiquitous here

@abhro
Copy link
Contributor Author

abhro commented Jul 11, 2025

Hi! I think I've addressed all the changes, it's most likely just the CI checks now

@icweaver
Copy link
Contributor

Oh, could we also add the generated index.md file to .gitignore? I accidentally uploaded it in another PR, haha. And probably /test/Manifest.toml for completeness too?

@abhro
Copy link
Contributor Author

abhro commented Jul 28, 2025

Done!

@icweaver
Copy link
Contributor

icweaver commented Jul 28, 2025

Sweet, thanks!

Have you been able to generate docs with the Mirror to DAMTP bit btw? I've been finding that since it it relies on an ENV in CI, it fails when I try to build locally, so I've just been commenting it our for now. I'm wondering if it would make sense to hide that bit behind a conditional flag that's called during CI?

@abhro
Copy link
Contributor Author

abhro commented Jul 28, 2025

Have you been able to generate docs with the Mirror to DAMTP bit btw? I've been finding that since it it relies on an ENV in CI, it fails when I try to build locally, so I've just been commenting it our for now. I'm wondering if it would make sense to hide that bit behind a conditional flag that's called during CI?

I'm guessing this part is meant for @MilesCranmer? I'm not sure I can offer much help on the deployment side of things

@icweaver
Copy link
Contributor

Sorry, I should have said "because of the Mirror to DAMTP bit" instead of "with the Mirror to DAMTP bit". In other words, this seems like an issue for anyone trying to build the docs locally, so I just wanted to see if we could smooth that process out a bit for folks.

Similarly, I was wondering if it might also be good to add a tip about using LiveServer.jl with something like:

servedocs(; include_dirs=["src/"], skip_files=["docs/src/index.md"])

so things work well from the jump. Anyway, just wanted to get your perspective to get an idea of if something like this would be helpful or not, haha

@abhro
Copy link
Contributor Author

abhro commented Jul 29, 2025

Sorry, I should have said "because of the Mirror to DAMTP bit" instead of "with the Mirror to DAMTP bit". In other words, this seems like an issue for anyone trying to build the docs locally, so I just wanted to see if we could smooth that process out a bit for folks.

Mmm, yes, that's probably a good idea to add a guard to check if the build is happening in CI or not.

@icweaver
Copy link
Contributor

icweaver commented Aug 2, 2025

Cool how about just wrapping the deploydocs bit in something like this?

in_CI_env = get(ENV, "CI", nothing) == "true"

if in_CI_env
    deploydocs(;
        repo="github.com/SymbolicML/DynamicQuantities.jl",
        devbranch="main"
    )

    # Mirror to DAMTP:
    ENV["DOCUMENTER_KEY"] = ENV["DOCUMENTER_KEY_CAM"]
    ENV["GITHUB_REPOSITORY"] = "ai-damtp-cam-ac-uk/dynamicquantities.git"
    deploydocs(;
        repo="github.com/ai-damtp-cam-ac-uk/dynamicquantities.git",
        devbranch="main"
    )
end

@MilesCranmer
Copy link
Member

That looks ok but the environment variable should be more specific. Like “DEPLOY_DOCUMENTER” or something. And just have the default be “false” rather than nothing

Copy link

codecov bot commented Aug 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.21%. Comparing base (3e4e19d) to head (f85fd82).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #175   +/-   ##
=======================================
  Coverage   99.21%   99.21%           
=======================================
  Files          21       21           
  Lines        1273     1273           
=======================================
  Hits         1263     1263           
  Misses         10       10           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@icweaver
Copy link
Contributor

icweaver commented Aug 6, 2025

Sweet, thx! Could you also add that CI guard Miles mentioned?

@icweaver
Copy link
Contributor

Howdy folks, just wanted to check if there was anything else still needed for this PR. Did we want in_CI_env renamed to DEPLOY_DOCUMENTER? cc: @MilesCranmer

Copy link
Member

@MilesCranmer MilesCranmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@MilesCranmer MilesCranmer merged commit 8b616e4 into JuliaPhysics:main Aug 16, 2025
5 checks passed
@abhro abhro deleted the add-doctests branch August 16, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants